import {
	http,
	Method
} from "@/utils/request.js";

import api from "@/config/api.js";

/**
 * 获取聊天列表
 * @param 
 */
export function chatList() {
	return http.request({
		url: '/chat/list',
		method: Method.GET,
	});
}

/**
 * 获取指定聊天对象聊天记录
 * @param 
 */
export function historyList(id) {
	return http.request({
		url: `/chat/history/${id}`,
		method: Method.GET,
	});
}

/**
 * 发送消息
 * @param 
 */
export function sendChat(data) {
	return http.request({
		url: `/chat/send`,
		method: Method.POST,
		data
	});
}


/**
 * 置顶聊天
 * @param 
 */
export function topChat(data) {
	return http.request({
		url: `/chat/top`,
		method: Method.POST,
		data
	});
}

/**
 * 删除会话
 * @param 
 */
export function deleteChat(id) {
	return http.request({
		url: `/chat/${id}`,
		method: Method.DELETE,
	});
}